package cn.itzzx.resume.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * 用户登陆
 * @author Martin
 * @since 1.0
 */
@Controller
public class LoginController {


    @RequestMapping("login")
    public String login(HttpServletRequest request, String userName, String password){
        if ("admin".equals(userName) && "admin".equals(password)) {
            //保存用户信息到session中
            request.getSession().setAttribute("user", "userInfo");
            //登陆成功 跳转到查询
            return "redirect:resume/list";
        }
        return "redirect:/";
    }

}
